package com.sgb.kjwl.model.entity;

import com.contrarywind.interfaces.IPickerViewData;
import com.google.gson.annotations.SerializedName;

import java.io.Serializable;

public class ParentAreaMeasureEntity<T> implements IPickerViewData, Serializable {
    @SerializedName("id")
    private String id;
    @SerializedName(value = "name", alternate = {"service_class", "service_category", "areaName"})
    private String name;
    @SerializedName("no")
    private String no = "";
    @SerializedName("parentNo")
    private String parentNo;
    @SerializedName(value = "children", alternate = {"cityList"})
    T children;

    public ParentAreaMeasureEntity() {
    }

    public ParentAreaMeasureEntity(String id, String name, String no) {
        this.id = id;
        this.name = name;
        this.no = no;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getNo() {
        return no;
    }

    public void setNo(String no) {
        this.no = no;
    }

    public String getParentNo() {
        return parentNo;
    }

    public void setParentNo(String parentNo) {
        this.parentNo = parentNo;
    }

    public T getChildren() {
        return children;
    }

    public void setChildren(T children) {
        this.children = children;
    }

    @Override
    public String getPickerViewText() {
        if (name.length() > 10) {
            return name.substring(0, 10) + "...";
        }
        return name;
    }
}
